<% layout('/layouts/default.html', {title: '结算记录管理', libs: ['validate','fileupload','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text('结算审核')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${settlementRecord}" action="${ctx}/settlementrecord/settlementRecord/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('结算信息')}</div>
				<#form:hidden path="id"/>
				<#form:hidden path="settlementApplyId"/>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('结算金额')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="settlementAmount" class="form-control required number" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('结算账号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="settlementAccount" maxlength="30" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('提交人')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="submitter" maxlength="10" class="form-control required" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('交易信息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="tradeInformation" maxlength="100" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('结算方式')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:radio path="clearingForm" dictType="clearing_form" class="form-control required" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('结算时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="settlementTime" readonly="true" maxlength="20" class="form-control Wdate required"
									dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('备注信息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">
								<span class="required">*</span> ${text('结算凭证')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadFile" bizKey="${settlementRecord.id}" bizType="settlementRecord_file"
									uploadType="image" maxUploadNum="1" class="required" readonly="false"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			
			<div class="form-unit">${text('订单信息')}</div>
			<div style="width:98%;margin-left:1%">
			    <table id="dataGrid"></table>
			    <div id="dataGridPage"></div>
			</div>
			
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if (hasPermi('settlementrecord:settlementRecord:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
		
        <#form:form id="searchForm" model="" action="" method="post" class="form-inline"
            data-page-no="${parameter.pageNo}" data-page-size="10" data-order-by="${parameter.orderBy}">
        </#form:form>
		
	</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});

$(document).ready(function () {	
	var settlementApplyId = '${settlementRecord.settlementApplyId}';
	var url = '${ctx}/settlementapply/settlementApply/settlementApplyItemListData?settlementApplyId=' + settlementApplyId;
	$("#searchForm").attr("action", url);
	// 初始化DataGrid对象
	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm"),
		columnModel: [
	          {header:'${text("订单号")}', name:'orderNum', index:'a.order_num', width:150, align:"center"},
	          {header:'${text("订单金额")}', name:'orderMoney', index:'a.order_money', width:150, align:"center", formatter: function(val, obj, row, act){
	  			return val + "元"; 
	  		  }},
	          {header:'${text("结算类型")}', name:'settlementType', index:'a.settlement_type', width:150, align:"center"},
	          {header:'${text("结算金额")}', name:'settlementMoney', index:'a.settlement_money', width:150, align:"center", formatter: function(val, obj, row, act){
	  			return val + "元"; 
			  }},
		],
	}); 
})
</script>